/*
* Copyrigth 2008 Company All rigths reserved
* File Name: ILaboratory.cs
* Created By:    Wenbin.Xu
* Created Date:   2013/7/8 16:33:23
* Description:    Laboratory模块的接口
* Change History: 
* 
* */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrainingsApp.Model;
using TrainingsApp.DAL;
using System.Web.UI.WebControls;

namespace TrainingsApp.Logic {
    public class TS_User_Children_Logic {
        public static TS_User_Children_Collecion TS_User_Children_ListByPaging(int pageSize, int pageIndex) {
            return TS_User_Children_DAL.TS_User_Children_ListByPaging(pageSize, pageIndex);
        }

        public static TS_User_Children_Collecion TS_User_Children_ListToGridByPaging(int pageSize, int pageIndex, System.Collections.Specialized.StringDictionary wheres) {
            return TS_User_Children_DAL.TS_User_Children_ListToGridByPaging(pageSize, pageIndex, WhereHelper.ConvertToAndSQL(wheres));
        }

        public static TS_User_Children_Entity TS_User_Children_View(System.Int64 UserId) {
            return TS_User_Children_DAL.TS_User_Children_View(UserId);
        }

        public static TS_User_Children_Entity TS_User_Children_Add(TS_User_Children_Entity entity, TS_User_Patriarch_Entity parentEntity) {
            var addEntity = TS_User_Children_DAL.TS_User_Children_Add(entity, parentEntity);


            TrainingsApp.Logic.Sys_Permission_Logic.T_USER_Role_Update(entity.UserId.Value, new List<TS_USER_ROLE_Entity> { 
                 new TS_USER_ROLE_Entity{
                  ROLEID =(int) UserType.Children,
                   USERID = (int)addEntity.UserId.Value
                 }
                });

            return addEntity;
        }

        public static void TS_User_Children_Update(TS_User_Children_Entity entity, TS_User_Patriarch_Entity parentEntity) {
            TS_User_Children_DAL.TS_User_Children_Update(entity, parentEntity);
        }

        public static void TS_User_Children_Delete(System.Int64 UserId) {
            TS_User_Children_DAL.TS_User_Children_Delete(UserId);
        }


    }
}
